# Contributor: Steven Guikal <void@fluix.one>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-fastapi
pkgver=0.111.0
pkgrel=0
pkgdesc="Modern, high-performance, web framework for building APIs based on standard Python type hints"
url="https://github.com/tiangolo/fastapi"
# loongarch64: blocked by py3-pydantic
arch="noarch !loongarch64"
license="MIT"
depends="
	py3-pydantic
	py3-starlette
	"
makedepends="
	py3-gpep517
	py3-installer
	py3-pdm-backend
	"
checkdepends="
	py3-aiosqlite
	py3-anyio
	py3-databases
	py3-dirty-equals
	py3-email-validator
	py3-flask
	py3-httpx
	py3-orjson
	py3-passlib
	py3-pytest
	py3-pydantic-settings
	py3-python-jose
	py3-python-multipart
	py3-sqlalchemy
	py3-trio
	py3-ujson
	py3-yaml
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tiangolo/fastapi/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/fastapi-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 -m installer .dist/*.whl
	# The deselected tests are failing with "DeprecationWarning: The 'app' shortcut is now deprecated..."
	# This has to be addressed upstream
	testenv/bin/python3 -m pytest \
		--deselect tests/test_tutorial/test_async_tests/test_main.py::test_root[asyncio] \
		--deselect tests/test_tutorial/test_async_tests/test_main.py::test_async_testing[asyncio] \
		--deselect tests/test_tutorial/test_async_tests/test_main.py::test_root[trio] \
		--deselect tests/test_tutorial/test_async_tests/test_main.py::test_async_testing[trio]
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
3b613e4b2e7253fa08c09f961e69d384d2f44d07dc7f045b669c3e78f21a161715f3e9a0cb813a1c6e793f4a322160ec3eeb4eef90ba59db64bde9baaa539c13  py3-fastapi-0.111.0.tar.gz
"
